//
//  XQToollUtil.m
//  JoinPeso
//
//  Created by 小琦 on 2024/12/6.
//

#import "XQToollUtil.h"

static NSString *safeString(NSString *string) {
    static NSDictionary *dic;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        dic = @{@"NIL" :    (id)kCFNull,
                @"Nil" :    (id)kCFNull,
                @"nil" :    (id)kCFNull,
                @"NULL" :   (id)kCFNull,
                @"Null" :   (id)kCFNull,
                @"null" :   (id)kCFNull,
                @"(NULL)" : (id)kCFNull,
                @"(Null)" : (id)kCFNull,
                @"(null)" : (id)kCFNull,
                @"<NULL>" : (id)kCFNull,
                @"<Null>" : (id)kCFNull,
                @"<null>" : (id)kCFNull};
    });
    if (!string) return @"";
    if (![string isKindOfClass:[NSString class]]) return @"";
    id obj = dic[string];
    if (obj == (id)kCFNull) return @"";
    return string;
}

XQUtils_t XQUtils = {
    safeString,
};
